package com.test.view;

import com.test.adapter.ImageAdapter;
import com.test.adapter.ImageListItemAdapter;
import com.test.demo.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;


/**
 * 大厅界面
 * @author Harry
 *
 */
public class HallActivity extends Activity implements OnItemClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		this.setContentView(R.layout.activity_hall);
		
		addImageToGrid();
	}
	
	/**
	 * 添加图片
	 */
	private void addImageToGrid(){	
		
		GridView gridView = (GridView)this.findViewById(R.id.hall_gridView);
		
		ImageListItemAdapter adapter = new ImageListItemAdapter(this);
		if(gridView != null){
			gridView.setAdapter(adapter);
			gridView.setOnItemClickListener(this);
		}
	}
	
	
	/**
	 * 点击图片回调
	 */
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
			long arg3){
		
		Intent intent = new Intent();
		intent.setClass(HallActivity.this, ImageInfoActivity.class);
		startActivity(intent);
		
	}

}
